﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using BCDataCenter.DataAccessLayer;

/// <summary>
/// Summary description for BWHRTrainCourse
/// </summary>
namespace BCDataCenter.BOL
{
    public class BWHRTrainCourse
    {
        string SqlInsert = "HRTrainCourseInsert";
        string SqlUpdate = "HRTrainCourseUpdate";
        string SqlGetData = "HRTrainCourseGetList";
        string SqlIsExistCourseID = "IsExistCourseID";
        public BWHRTrainCourse()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        public bool Insert(ref string error, string CourseID, string CourseDesc, string CourseMoreDesc)
        {
            return new DAL().MyExecuteNonQuery(SqlInsert, System.Data.CommandType.StoredProcedure, ref error,
                new SqlParameter("@CourseID", CourseID),
                new SqlParameter("@CourseDesc", CourseDesc),
                new SqlParameter("@CourseMoreDesc", CourseMoreDesc)
                );
        }
        public bool Update(ref string error, string CourseID, string CourseDesc, string CourseMoreDesc)
        {
            return new DAL().MyExecuteNonQuery(SqlUpdate, System.Data.CommandType.StoredProcedure, ref error,
                new SqlParameter("@CourseID", CourseID),
                new SqlParameter("@CourseDesc", CourseDesc),
                new SqlParameter("@CourseMoreDesc", CourseMoreDesc)
                );
        }
        public bool IsExistCourseID(ref string error, string CourseID)
        {
            return new DAL().IsExistFromSQL(SqlIsExistCourseID, System.Data.CommandType.StoredProcedure, ref error, new SqlParameter("@CourseID", CourseID));
        }
        public System.Data.DataSet CourseInfo(ref string error, string CourseID)
        {
            return new DAL().MyExecuteQuery(ref error, SqlIsExistCourseID, System.Data.CommandType.StoredProcedure, new SqlParameter("@CourseID", CourseID));
        }

        public System.Data.DataSet dsList(ref string error)
        {
            return new DAL().MyExecuteReader(ref error, SqlGetData, System.Data.CommandType.StoredProcedure);
        }
    }
}
